package com.hngy.xpq.android_practice.user_main;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.ImageButton;

import com.hngy.xpq.android_practice.OrderUserRegist;
import com.hngy.xpq.android_practice.R;


public class UserTime extends AppCompatActivity {

    DatePicker time;
    Button qd;
    ImageButton previous;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_zc_time);
        qd = findViewById(R.id.button_tp);
        time = findViewById(R.id.dp_time);
        previous = findViewById(R.id.time_previous);
        qd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int year = time.getYear();
                int month = time.getMonth() + 1;
                int day = time.getDayOfMonth();
                String ymd = year + "-" + month + "-" + day;
                Intent intent = new Intent(UserTime.this, OrderUserRegist.class);
                intent.putExtra("time",ymd);
                startActivity(intent);
                finish();
            }
        });
        previous.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}